package net.j4love.json.jackson.example.quickstart;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.IOException;
import java.util.Map;


/**
 * @author He Peng
 * @create 2017-05-21 15:32
 * @update 2017-05-21 15:32
 * @updatedesc : 更新说明
 * @see
 */
public class JacksonDeserialize {

    public static void main(String[] args) throws IOException {

        String text = "{\n" +
                "  \"爱好\" : \"出现在各类九年制义务教育教材中\",\n" +
                "  \"name\" : \"小明\",\n" +
                "  \"格言\" : \"我也很无奈啊\",\n" +
                "  \"年龄\" : 12,\n" +
                "  \"性别\" : \"男\"\n" +
                "}";

        ObjectMapper objmpr = new ObjectMapper();
        objmpr.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
        Map map = objmpr.readValue(text, Map.class);

        System.out.println(map);

    }
}
